import gdb

# A ConnectionManager which encapsulates Qemu-specific connection commands.
# USED BY: Activator.

class QemuConnectionManager(object):
    def __init__(self, port):
        self.port = port

    # Connect to Qemu.
    def connect(self):
        gdb.execute("target remote localhost:%s" % self.port)

    # Disconnect from Qemu.
    def disconnect(self):
        gdb.execute("disconnect")

    # Reset Qemu.
    def resetTarget(self):
        gdb.execute("monitor system_reset")
